From d77a2405c947a14fa105ab35ccb32a2194b3fbdd Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 30 Jun 2005 07:43:18 +0000 Subject: [PATCH] Change vito to KNOTS instead of meters. Adapt nmea reade. --- defs.h | 9 + nmea.c | 168 ++++++++++++- reference/track/vitosmt_t.gpx | 456 +++++++++++++++++----------------- vitosmt.c | 5 +- 4 files changed, 398 insertions(+), 240 deletions(-) diff --git a/defs.h b/defs.h index ef85b0ffc..fe22f63b1 100644 --- a/defs.h +++ b/defs.h @@ -70,6 +70,14 @@ typedef enum { rtedata } gpsdata_type; +typedef enum { + fix_unknown, + fix_2d, + fix_3d, + fix_dgps, + fix_pps +} fix_type; + #define NOTHINGMASK 0 #define WPTDATAMASK 1 #define TRKDATAMASK 2 @@ -251,6 +259,7 @@ typedef struct { float pdop; float course; /* Optional: degrees true */ float speed; /* Optional: meters per second. */ + char fix, sat; geocache_data gc_data; xml_tag *gpx_extras; diff --git a/nmea.c b/nmea.c index 5b00d7b75..1ae6fbc69 100644 --- a/nmea.c +++ b/nmea.c @@ -67,6 +67,35 @@ ' 10 300504 Date 30/05-2004 ' 11 Empty field Magnetic variation + GSA - GPS DOP and active satellites + $GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39 + A Auto selection of 2D or 3D fix (M = manual) + 3 3D fix + 04,05... PRNs of satellites used for fix (space for 12) + 2.5 PDOP (dilution of precision) + 1.3 Horizontal dilution of precision (HDOP) + 2.1 Vertical dilution of precision (VDOP) + DOP is an indication of the effect of satellite geometry on + the accuracy of the fix. + + VTG - Track made good and ground speed + $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K + 054.7,T True track made good + 034.4,M Magnetic track made good + 005.5,N Ground speed, knots + 010.2,K Ground speed, Kilometers per hour + + WPL - waypoint location + $GPWPL,4917.16,N,12310.64,W,003*65 + 4917.16,N Latitude of waypoint + 12310.64,W Longitude of waypoint + 003 Waypoint ID + When a route is active, this sentence is sent once for each + waypoint in the route, in sequence. When all waypoints have + been reported, GPR00 is sent in the next data set. In any + group of sentences, only one WPL sentence, or an R00 + sentence, will be sent. + ' The optional checksum field consists of a "*" and two hex digits repre- ' senting the exclusive OR of all characters between, but not including, @@ -93,9 +122,13 @@ static route_head *trk_head; static void *mkshort_handle; static preferred_posn_type posn_type; static time_t creation_time; +static waypoint * curr_waypt =NULL; #define MYNAME "nmea" +static const double kts2mps =0.51444444444444444; /* knots to m/s */ +static const double kmh2mps =0.27777777777777778; /* km/h to m/s */ + /* * Slightly different than the Magellan checksum fn. */ @@ -178,6 +211,7 @@ gpgll_parse(char *ibuf) if (lngdir == 'W') lngdeg = -lngdeg; waypt->longitude = ddmm2degrees(lngdeg); + curr_waypt = waypt; route_add_wpt(trk_head, waypt); } @@ -187,11 +221,11 @@ gpgga_parse(char *ibuf) double latdeg, lngdeg; char lngdir, latdir; double hms; - int fix = 0; - int nsats; - double hdop; struct tm tm; double alt; + int fix; + int nsats; + double hdop; char altunits; waypoint *waypt; @@ -207,8 +241,9 @@ gpgga_parse(char *ibuf) &lngdeg,&lngdir, &fix,&nsats,&hdop,&alt,&altunits); - if (fix == 0) + if (fix == 0) { return; + } tm.tm_sec = (long) hms % 100; hms = hms / 100; @@ -227,8 +262,23 @@ gpgga_parse(char *ibuf) waypt->longitude = ddmm2degrees(lngdeg); waypt->altitude = alt; + + waypt->sat = nsats; + + waypt->hdop = hdop; + + if (fix==1) { + waypt->fix = (nsats>4)?(fix_3d):(fix_2d); + } + else if (fix==2) + { + waypt->fix = fix_dgps; + } + + curr_waypt = waypt; route_add_wpt(trk_head, waypt); + } static void @@ -237,10 +287,10 @@ gprmc_parse(char *ibuf) double latdeg, lngdeg; char lngdir, latdir; double hms; - double speed, course; char fix; unsigned int dmy; struct tm tm; + double speed,course; waypoint *waypt; if (trk_head == NULL) { @@ -254,9 +304,7 @@ gprmc_parse(char *ibuf) &hms, &fix, &latdeg, &latdir, &lngdeg, &lngdir, &speed, &course, &dmy); - - if (fix != 'A') - return; + tm.tm_sec = (long) hms % 100; hms = hms / 100; tm.tm_min = (long) hms % 100; @@ -274,6 +322,11 @@ gprmc_parse(char *ibuf) return; waypt = waypt_new(); + + waypt->speed = speed*kts2mps; + + waypt->course = course; + waypt->creation_time = creation_time; if (latdir == 'S') latdeg = -latdeg; @@ -282,6 +335,7 @@ gprmc_parse(char *ibuf) if (lngdir == 'W') lngdeg = -lngdeg; waypt->longitude = ddmm2degrees(lngdeg); + curr_waypt = waypt; route_add_wpt(trk_head, waypt); } @@ -307,6 +361,7 @@ gpwpl_parse(char *ibuf) waypt->shortname = xstrdup(sname); + curr_waypt = NULL; /* waypoints won't be updated with GPS fixes */ waypt_add(waypt); } @@ -330,6 +385,68 @@ gpzda_parse(char *ibuf) creation_time = mkgmtime(&tm); } +static void +gpgsa_parse(char *ibuf) +{ + char fixauto; + char fix; + int prn[12]; + int cnt; + float pdop,hdop,vdop; + + sscanf(ibuf,"$GPGSA,%c,%c,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f,%f", + &fixauto, &fix, + &prn[0],&prn[1],&prn[2],&prn[3],&prn[4],&prn[5], + &prn[6],&prn[7],&prn[8],&prn[9],&prn[10],&prn[11], + &pdop,&hdop,&vdop); + + if (curr_waypt) { + + if (curr_waypt->fix!=fix_dgps) { + if (fix=='3') curr_waypt->fix=fix_3d; + else if (fix=='2') curr_waypt->fix=fix_2d; + } + + curr_waypt->pdop = pdop; + curr_waypt->hdop = hdop; + curr_waypt->vdop = vdop; + + if (curr_waypt->sat <= 0) { + for (cnt=0;cnt<12;cnt++) + curr_waypt->sat += (prn[cnt]>0)?(1):(0); + } + } + +} + +static void +gpvtg_parse(char *ibuf) +{ + float course; + char ct; + float magcourse; + char cm; + double speed_n; + char cn; + double speed_k; + char ck; + + sscanf(ibuf,"$GPVTG,%f,%c,%f,%c,%f,%c,%f,%c", + &course,&ct,&magcourse,&cm,&speed_n,&cn,&speed_k,&ck); + + if (curr_waypt) { + curr_waypt->course = course; + + if (speed_k>0) + curr_waypt->speed = speed_k*kmh2mps; + else + curr_waypt->speed = speed_n*kts2mps; + + } + +} + + static void nmea_read(void) { @@ -340,6 +457,8 @@ nmea_read(void) creation_time = mkgmtime(&tm) + current_time(); + curr_waypt = NULL; + while (fgets(ibuf, sizeof(ibuf), file_in)) { ck = strrchr(ibuf, '*'); if (ck != NULL) { @@ -380,10 +499,17 @@ nmea_read(void) } else if (0 == strncmp(ibuf, "$GPZDA,",7)) { gpzda_parse(ibuf); + } else + if (0 == strncmp(ibuf, "$GPVTG,",7)) { + gpvtg_parse(ibuf); /* speed and course */ + } else + if (0 == strncmp(ibuf, "$GPGSA,",7)) { + gpgsa_parse(ibuf); /* GPS fix */ } } } + static void nmea_wayptpr(const waypoint *wpt) { @@ -428,14 +554,36 @@ nmea_trackpt_pr(const waypoint *wpt) hms = 0; } - snprintf(obuf, sizeof(obuf), "GPGGA,%06d,%08.3f,%c,%09.3f,%c,04,0,0,%.3f,M,0.0,M,,", + snprintf(obuf, sizeof(obuf), "GPGGA,%06d,%08.3f,%c,%09.3f,%c,%c,%02d,%.1f,%.3f,M,0.0,M,,", hms, fabs(lat), lat < 0 ? 'S' : 'N', fabs(lon), lon < 0 ? 'W' : 'E', + (wpt->fix==fix_dgps)?('2'):('1'), + wpt->sat, + wpt->hdop, wpt->altitude == unknown_alt ? 0 : wpt->altitude); - cksum = nmea_cksum(obuf); fprintf(file_out, "$%s*%02X\n", obuf, cksum); + + if ( (wpt->course>=0) || + (wpt->speed>0) ) + { + snprintf(obuf,sizeof(obuf),"$GPVTG,%f,T,0,M,%f,N,%f,K", + wpt->course, + wpt->speed / kts2mps, + wpt->speed / kmh2mps); + } + + if (wpt->fix!=fix_unknown) { + snprintf(obuf,sizeof(obuf),"$GPGSA,A,%c,,,,,,,,,,,,,%f,%f,%f", + ((wpt->fix==fix_dgps)||(wpt->fix==fix_3d))?'3':'2', + wpt->pdop, + wpt->hdop, + wpt->vdop); + cksum = nmea_cksum(obuf); + fprintf(file_out, "$%s*%02X\n", obuf, cksum); + } + } static void diff --git a/reference/track/vitosmt_t.gpx b/reference/track/vitosmt_t.gpx index 354c9a1de..5b85ba0c4 100644 --- a/reference/track/vitosmt_t.gpx +++ b/reference/track/vitosmt_t.gpx @@ -28,7 +28,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 105.400000 251.259995 - 1.233828 + 1.419867 WP0003 1.400000 @@ -36,7 +36,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 104.600000 260.420013 - 1.260651 + 1.450733 WP0004 2.400000 @@ -44,7 +44,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 102.500000 232.600006 - 0.290576 + 0.334389 WP0005 2.400000 @@ -52,7 +52,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 108.900000 297.440002 - 0.961134 + 1.106055 WP0006 2.200000 @@ -60,7 +60,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 108.400000 290.190002 - 1.010309 + 1.162644 WP0007 1.000000 @@ -68,7 +68,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 110.600000 30.709999 - 0.965605 + 1.111200 WP0008 1.400000 @@ -76,7 +76,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 106.200000 32.630001 - 0.160934 + 0.185200 WP0009 1.000000 @@ -92,7 +92,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ -22.300000 150.550003 - 1.283003 + 1.476456 WP0011 2.600000 @@ -100,7 +100,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ -34.800000 140.809998 - 1.332177 + 1.533044 WP0012 3.400000 @@ -108,7 +108,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ -28.700000 165.830002 - 1.166772 + 1.342700 WP0013 2.600000 @@ -116,7 +116,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ -21.000000 166.179993 - 0.639266 + 0.735656 WP0014 3.800000 @@ -124,14 +124,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ -25.300000 114.070000 - 1.309825 + 1.507322 WP0015 43.400000 79.120003 - 1.318766 + 1.517611 WP0016 3.800000 @@ -139,7 +139,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 39.300000 65.169998 - 1.198065 + 1.378711 WP0017 1.600000 @@ -147,7 +147,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 48.300000 87.449997 - 1.095246 + 1.260389 WP0018 1.600000 @@ -155,7 +155,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 44.500000 88.230003 - 1.283003 + 1.476456 WP0019 1.600000 @@ -163,7 +163,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 39.900000 68.449997 - 1.354529 + 1.558767 WP0020 2.600000 @@ -171,7 +171,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 23.600000 140.080002 - 0.120701 + 0.138900 WP0021 2.600000 @@ -179,7 +179,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 46.700000 114.720001 - 0.169875 + 0.195489 WP0022 4.000000 @@ -187,7 +187,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 61.300000 128.500000 - 0.147523 + 0.169767 WP0023 1.600000 @@ -195,7 +195,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.600000 0.890000 - 0.227990 + 0.262367 WP0024 4.000000 @@ -203,7 +203,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 63.600000 214.169998 - 0.125171 + 0.144044 WP0025 2.200000 @@ -211,7 +211,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 83.600000 156.059998 - 0.178816 + 0.205778 WP0026 5.200000 @@ -219,7 +219,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 76.200000 136.899994 - 0.071526 + 0.082311 WP0027 5.200000 @@ -227,7 +227,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 76.300000 151.399994 - 0.093878 + 0.108033 WP0028 10.600000 @@ -259,7 +259,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 34.300000 157.210007 - 0.031293 + 0.036011 WP0032 28.200001 @@ -267,7 +267,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 70.800000 31.549999 - 0.102819 + 0.118322 WP0033 1.800000 @@ -275,7 +275,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 61.200000 160.520004 - 0.907490 + 1.044322 WP0034 2.000000 @@ -283,14 +283,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 62.400000 162.570007 - 0.089408 + 0.102889 WP0035 54.200000 66.839996 - 0.357631 + 0.411556 WP0036 6.800000 @@ -322,7 +322,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.800000 51.320000 - 0.075997 + 0.087456 WP0040 1.000000 @@ -330,7 +330,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 95.100000 22.510000 - 0.080467 + 0.092600 WP0041 1.600000 @@ -338,7 +338,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 69.100000 272.899994 - 1.050542 + 1.208944 WP0042 1.000000 @@ -346,7 +346,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.300000 304.450012 - 1.032661 + 1.188367 WP0043 1.000000 @@ -354,7 +354,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.300000 321.899994 - 1.157832 + 1.332411 WP0044 1.400000 @@ -362,7 +362,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.300000 346.209991 - 0.742085 + 0.853978 WP0045 1.400000 @@ -370,7 +370,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 70.700000 31.530001 - 0.035763 + 0.041156 WP0046 1.400000 @@ -378,7 +378,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 68.400000 124.980003 - 0.701852 + 0.807678 WP0047 1.200000 @@ -386,7 +386,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.900000 301.549988 - 1.131009 + 1.301544 WP0048 1.200000 @@ -394,7 +394,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.400000 312.899994 - 0.424687 + 0.488722 WP0049 1.000000 @@ -402,7 +402,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.200000 54.860001 - 0.067056 + 0.077167 WP0050 1.000000 @@ -410,7 +410,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.600000 338.209991 - 1.582519 + 1.821133 WP0051 1.400000 @@ -418,21 +418,21 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.000000 300.459991 - 0.549858 + 0.632767 WP0052 72.100000 306.429993 - 0.920901 + 1.059756 WP0053 72.700000 284.540009 - 0.840434 + 0.967156 WP0054 6.200000 @@ -440,28 +440,28 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.200000 310.510010 - 0.563269 + 0.648200 WP0055 72.500000 208.550003 - 0.460450 + 0.529878 WP0056 73.000000 292.980011 - 1.367940 + 1.574200 WP0057 73.300000 348.260010 - 1.224888 + 1.409578 WP0058 19.400000 @@ -469,7 +469,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 78.100000 357.940002 - 1.175713 + 1.352989 WP0059 6.000000 @@ -477,7 +477,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 77.000000 341.100006 - 0.786789 + 0.905422 WP0060 4.200000 @@ -485,7 +485,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 75.500000 11.500000 - 0.187756 + 0.216067 WP0061 4.200000 @@ -493,7 +493,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.000000 26.420000 - 0.701852 + 0.807678 WP0062 12.400000 @@ -501,7 +501,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 75.800000 37.529999 - 1.032661 + 1.188367 WP0063 4.200000 @@ -509,7 +509,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.600000 48.630001 - 1.327707 + 1.527900 WP0064 1.600000 @@ -517,7 +517,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 70.300000 26.750000 - 0.920901 + 1.059756 WP0065 2.800000 @@ -525,7 +525,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.600000 201.380005 - 0.733144 + 0.843689 WP0066 1.800000 @@ -533,7 +533,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 76.300000 117.099998 - 0.397865 + 0.457856 WP0067 1.600000 @@ -541,7 +541,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.100000 130.149994 - 0.129641 + 0.149189 WP0068 5.200000 @@ -549,7 +549,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 80.900000 129.250000 - 0.272694 + 0.313811 WP0069 4.000000 @@ -557,7 +557,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 89.500000 87.769997 - 0.053645 + 0.061733 WP0070 4.000000 @@ -565,7 +565,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 102.100000 164.850006 - 0.107289 + 0.123467 WP0071 2.200000 @@ -573,7 +573,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 102.800000 244.000000 - 0.344220 + 0.396122 WP0072 13.400000 @@ -581,7 +581,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 94.100000 86.839996 - 0.706322 + 0.812822 WP0073 1.600000 @@ -589,7 +589,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 93.300000 216.110001 - 0.102819 + 0.118322 WP0074 1.600000 @@ -597,21 +597,21 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 83.800000 250.699997 - 1.041601 + 1.198656 WP0075 85.100000 238.919998 - 1.439466 + 1.656511 WP0076 85.600000 235.460007 - 1.493111 + 1.718244 WP0077 16.000000 @@ -619,14 +619,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 85.900000 248.250000 - 1.166772 + 1.342700 WP0078 85.200000 260.279999 - 0.862786 + 0.992878 WP0079 2.400000 @@ -634,7 +634,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 87.100000 215.869995 - 1.104187 + 1.270678 WP0080 3.200000 @@ -642,7 +642,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 82.300000 238.919998 - 0.952194 + 1.095767 WP0081 1.200000 @@ -650,7 +650,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 78.800000 235.889999 - 0.862786 + 0.992878 WP0082 2.400000 @@ -658,7 +658,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 75.500000 228.059998 - 0.858315 + 0.987733 WP0083 1.400000 @@ -666,7 +666,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.100000 322.799988 - 1.001368 + 1.152356 WP0084 2.000000 @@ -674,14 +674,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.500000 333.309998 - 0.406806 + 0.468144 WP0085 74.000000 154.389999 - 1.108657 + 1.275822 WP0086 40.599998 @@ -689,7 +689,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.700000 197.889999 - 1.072894 + 1.234667 WP0087 2.000000 @@ -697,21 +697,21 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.300000 194.039993 - 0.317398 + 0.365256 WP0088 72.200000 237.380005 - 0.675029 + 0.776811 WP0089 73.000000 272.200012 - 0.759967 + 0.874556 WP0090 38.200001 @@ -719,14 +719,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.400000 214.550003 - 0.151993 + 0.174911 WP0091 81.200000 209.389999 - 0.187756 + 0.216067 WP0092 37.200001 @@ -734,7 +734,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 70.100000 256.739990 - 0.585621 + 0.673922 WP0093 9.400000 @@ -742,21 +742,21 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 64.400000 294.750000 - 0.710792 + 0.817967 WP0094 64.000000 174.509995 - 0.536447 + 0.617333 WP0095 64.600000 122.470001 - 0.625855 + 0.720222 WP0096 23.000000 @@ -764,7 +764,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 67.300000 189.600006 - 0.111760 + 0.128611 WP0097 5.200000 @@ -772,7 +772,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.400000 182.949997 - 0.093878 + 0.108033 WP0098 43.599998 @@ -780,7 +780,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 71.700000 52.070000 - 0.143053 + 0.164622 WP0099 24.200001 @@ -788,7 +788,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 72.300000 155.990005 - 0.098349 + 0.113178 WP0100 2.200000 @@ -796,7 +796,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 81.200000 97.730003 - 0.965605 + 1.111200 WP0101 36.400002 @@ -804,14 +804,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 74.500000 50.860001 - 1.412644 + 1.625644 WP0102 74.700000 44.029999 - 1.171243 + 1.347844 WP0103 13.600000 @@ -819,7 +819,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 76.200000 82.080002 - 0.621385 + 0.715078 WP0104 50.000000 @@ -827,7 +827,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 77.900000 80.239998 - 0.648207 + 0.745944 WP0105 26.400000 @@ -835,7 +835,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 78.600000 47.939999 - 1.506522 + 1.733678 WP0106 50.000000 @@ -843,7 +843,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 80.700000 62.310001 - 0.970075 + 1.116344 WP0107 1.600000 @@ -851,14 +851,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 84.400000 59.770000 - 1.247240 + 1.435300 WP0108 92.600000 57.660000 - 1.095246 + 1.260389 WP0109 2.000000 @@ -866,7 +866,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 95.800000 55.730000 - 1.215947 + 1.399289 WP0110 5.000000 @@ -874,7 +874,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 94.700000 28.459999 - 1.117598 + 1.286111 WP0111 0.800000 @@ -882,7 +882,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 59.200000 245.169998 - 0.844904 + 0.972300 WP0112 9.400000 @@ -890,7 +890,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 55.200000 240.100006 - 1.350059 + 1.553622 WP0113 6.000000 @@ -898,7 +898,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 56.100000 238.809998 - 1.099717 + 1.265533 WP0114 7.600000 @@ -906,7 +906,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 54.500000 242.740005 - 1.028190 + 1.183222 WP0115 11.800000 @@ -914,14 +914,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 48.700000 236.539993 - 0.871727 + 1.003167 WP0116 43.700000 261.720001 - 1.488641 + 1.713100 WP0117 7.200000 @@ -929,14 +929,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 45.100000 298.739990 - 1.099717 + 1.265533 WP0118 44.600000 313.660004 - 1.032661 + 1.188367 WP0119 16.600000 @@ -944,21 +944,21 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 44.100000 330.829987 - 1.171243 + 1.347844 WP0120 43.000000 334.989990 - 1.041601 + 1.198656 WP0121 42.000000 341.049988 - 1.466289 + 1.687378 WP0122 7.200000 @@ -966,7 +966,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.400000 1.620000 - 1.385822 + 1.594778 WP0123 6.800000 @@ -974,7 +974,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.600000 18.180000 - 0.961134 + 1.106055 WP0124 6.800000 @@ -982,14 +982,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.600000 10.700000 - 1.139950 + 1.311833 WP0125 41.600000 333.260010 - 0.666089 + 0.766522 WP0126 7.000000 @@ -997,42 +997,42 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.600000 348.489990 - 0.979016 + 1.126633 WP0127 41.600000 335.130005 - 0.961134 + 1.106055 WP0128 41.600000 356.950012 - 1.506522 + 1.733678 WP0129 41.600000 344.679993 - 0.849375 + 0.977444 WP0130 41.600000 69.209999 - 1.077365 + 1.239811 WP0131 41.600000 83.389999 - 1.296414 + 1.491889 WP0132 7.400000 @@ -1040,7 +1040,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.700000 93.379997 - 1.363470 + 1.569056 WP0133 33.799999 @@ -1048,7 +1048,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.700000 105.099998 - 1.591460 + 1.831422 WP0134 6.800000 @@ -1056,14 +1056,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 41.800000 63.990002 - 1.193595 + 1.373567 WP0135 42.300000 67.769997 - 1.537815 + 1.769689 WP0136 21.799999 @@ -1071,7 +1071,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 45.200000 108.410004 - 1.180184 + 1.358133 WP0137 7.000000 @@ -1079,7 +1079,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 46.700000 104.510002 - 1.059483 + 1.219233 WP0138 8.400000 @@ -1087,7 +1087,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 47.400000 260.720001 - 0.889608 + 1.023744 WP0139 8.600000 @@ -1095,28 +1095,28 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 48.300000 274.910004 - 1.215947 + 1.399289 WP0140 49.000000 252.429993 - 0.697381 + 0.802533 WP0141 49.400000 174.869995 - 0.438098 + 0.504156 WP0142 49.900000 223.550003 - 0.728674 + 0.838544 WP0143 8.200000 @@ -1124,7 +1124,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 49.500000 255.070007 - 1.081835 + 1.244956 WP0144 6.400000 @@ -1132,7 +1132,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 55.000000 267.149994 - 0.938782 + 1.080333 WP0145 9.400000 @@ -1140,7 +1140,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 56.600000 158.740005 - 0.661618 + 0.761378 WP0146 5.400000 @@ -1148,7 +1148,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 56.100000 233.080002 - 0.974546 + 1.121489 WP0147 10.000000 @@ -1156,14 +1156,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 56.700000 150.190002 - 0.147523 + 0.169767 WP0148 70.600000 155.179993 - 0.795730 + 0.915711 WP0149 5.200000 @@ -1171,7 +1171,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 75.600000 137.089996 - 0.496214 + 0.571033 WP0150 5.000000 @@ -1179,7 +1179,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 76.100000 356.690002 - 0.196697 + 0.226356 WP0151 10.600000 @@ -1187,7 +1187,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 77.400000 233.190002 - 0.804671 + 0.926000 WP0152 6.400000 @@ -1195,28 +1195,28 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 84.500000 66.459999 - 0.934312 + 1.075189 WP0153 90.200000 285.640015 - 0.742085 + 0.853978 WP0154 93.200000 250.550003 - 1.055013 + 1.214089 WP0155 94.400000 245.679993 - 0.956664 + 1.100911 WP0156 6.400000 @@ -1224,14 +1224,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 95.400000 244.559998 - 1.032661 + 1.188367 WP0157 96.500000 262.299988 - 1.452878 + 1.671944 WP0158 6.200000 @@ -1239,14 +1239,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.300000 207.820007 - 0.929842 + 1.070044 WP0159 97.000000 269.070007 - 1.220417 + 1.404433 WP0160 6.200000 @@ -1254,14 +1254,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.900000 229.419998 - 0.853845 + 0.982589 WP0161 98.200000 242.610001 - 0.634796 + 0.730511 WP0162 6.200000 @@ -1269,7 +1269,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.600000 220.550003 - 1.300884 + 1.497033 WP0163 6.200000 @@ -1277,14 +1277,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.400000 237.889999 - 0.961134 + 1.106055 WP0164 98.200000 253.720001 - 1.256180 + 1.445589 WP0165 6.200000 @@ -1292,7 +1292,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.000000 224.910004 - 2.186022 + 2.515633 WP0166 6.200000 @@ -1300,7 +1300,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.600000 204.449997 - 2.136848 + 2.459044 WP0167 13.400000 @@ -1308,7 +1308,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.100000 185.449997 - 1.882035 + 2.165811 WP0168 3.200000 @@ -1316,7 +1316,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 94.800000 157.490005 - 1.756864 + 2.021767 WP0169 13.400000 @@ -1324,7 +1324,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 95.200000 137.639999 - 1.533345 + 1.764544 WP0170 13.600000 @@ -1332,7 +1332,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 93.600000 83.290001 - 1.265121 + 1.455878 WP0171 8.800000 @@ -1340,7 +1340,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 92.400000 86.800003 - 0.777848 + 0.895133 WP0172 3.000000 @@ -1348,7 +1348,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 91.200000 79.180000 - 0.719733 + 0.828256 WP0173 3.000000 @@ -1356,7 +1356,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 92.400000 82.589996 - 0.666089 + 0.766522 WP0174 6.200000 @@ -1364,7 +1364,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 94.400000 67.809998 - 0.831493 + 0.956867 WP0175 2.800000 @@ -1372,7 +1372,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 92.800000 43.900002 - 1.095246 + 1.260389 WP0176 2.800000 @@ -1380,7 +1380,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 94.900000 81.980003 - 0.992427 + 1.142067 WP0177 9.000000 @@ -1388,7 +1388,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 95.600000 109.800003 - 0.049174 + 0.056589 WP0178 2.800000 @@ -1396,7 +1396,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.300000 206.750000 - 0.545388 + 0.627622 WP0179 9.200000 @@ -1404,14 +1404,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.300000 186.479996 - 0.639266 + 0.735656 WP0180 98.800000 185.270004 - 0.420217 + 0.483578 WP0181 2.600000 @@ -1419,7 +1419,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.900000 166.690002 - 5.346590 + 6.152756 WP0182 9.600000 @@ -1427,77 +1427,77 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.600000 166.690002 - 5.346590 + 6.152756 WP0183 97.300000 166.690002 - 5.346590 + 6.152756 WP0184 97.500000 131.520004 - 21.422121 + 24.652178 WP0185 97.700000 135.419998 - 20.219585 + 23.268322 WP0186 98.100000 144.899994 - 18.270494 + 21.025345 WP0187 98.200000 147.210007 - 17.948626 + 20.654945 WP0188 98.200000 147.210007 - 17.948626 + 20.654945 WP0189 97.900000 160.369995 - 13.093780 + 15.068078 WP0190 97.800000 182.169998 - 8.583154 + 9.877334 WP0191 101.300000 174.380005 - 6.920168 + 7.963600 WP0192 105.300000 179.320007 - 7.233095 + 8.323711 WP0193 10.000000 @@ -1505,42 +1505,42 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 105.600000 183.029999 - 7.183921 + 8.267122 WP0194 105.700000 183.029999 - 7.183921 + 8.267122 WP0195 104.700000 126.190002 - 4.237932 + 4.876933 WP0196 103.600000 83.410004 - 12.467925 + 14.347856 WP0197 101.300000 84.290001 - 12.016416 + 13.828267 WP0198 99.900000 109.540001 - 13.858217 + 15.947778 WP0199 2.600000 @@ -1548,70 +1548,70 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.100000 115.199997 - 12.825557 + 14.759411 WP0200 97.900000 105.970001 - 14.694180 + 16.909788 WP0201 97.700000 105.970001 - 14.694180 + 16.909788 WP0202 97.700000 87.070000 - 12.342754 + 14.203811 WP0203 97.700000 85.029999 - 12.271228 + 14.121500 WP0204 97.500000 84.540001 - 16.191761 + 18.633179 WP0205 97.300000 84.480003 - 16.558334 + 19.055021 WP0206 97.100000 84.480003 - 16.558334 + 19.055021 WP0207 97.000000 84.480003 - 16.558334 + 19.055021 WP0208 97.100000 86.349998 - 6.540184 + 7.526322 WP0209 6.400000 @@ -1619,7 +1619,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.200000 103.959999 - 0.143053 + 0.164622 WP0210 6.400000 @@ -1627,7 +1627,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.100000 198.320007 - 0.151993 + 0.174911 WP0211 6.400000 @@ -1635,28 +1635,28 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 96.900000 2.360000 - 0.800200 + 0.920856 WP0212 96.900000 81.510002 - 12.834497 + 14.769700 WP0213 97.300000 94.290001 - 3.665722 + 4.218444 WP0214 97.200000 90.029999 - 1.260651 + 1.450733 WP0215 6.400000 @@ -1664,77 +1664,77 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 97.200000 91.970001 - 1.242769 + 1.430156 WP0216 97.100000 93.570000 - 13.648108 + 15.705989 WP0217 97.400000 93.570000 - 13.648108 + 15.705989 WP0218 97.500000 76.129997 - 12.512629 + 14.399300 WP0219 97.500000 75.209999 - 12.664622 + 14.574211 WP0220 97.500000 75.209999 - 12.664622 + 14.574211 WP0221 97.400000 75.209999 - 12.664622 + 14.574211 WP0222 97.400000 90.370003 - 11.435265 + 13.159489 WP0223 97.300000 111.029999 - 11.971711 + 13.776822 WP0224 97.300000 126.019997 - 13.473763 + 15.505356 WP0225 99.000000 171.699997 - 9.217950 + 10.607844 WP0226 2.000000 @@ -1742,14 +1742,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 99.300000 154.520004 - 5.686339 + 6.543733 WP0227 99.200000 159.869995 - 0.116230 + 0.133756 WP0228 2.000000 @@ -1757,7 +1757,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 99.000000 169.960007 - 0.134112 + 0.154333 WP0229 2.000000 @@ -1765,7 +1765,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.600000 167.100006 - 1.001368 + 1.152356 WP0230 2.000000 @@ -1773,35 +1773,35 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.300000 318.260010 - 0.751026 + 0.864267 WP0231 98.000000 76.680000 - 1.430526 + 1.646222 WP0232 98.200000 47.889999 - 2.825288 + 3.251289 WP0233 98.400000 47.889999 - 2.825288 + 3.251289 WP0234 98.400000 240.000000 - 0.107289 + 0.123467 WP0235 2.000000 @@ -1809,14 +1809,14 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ 98.100000 159.000000 - 0.111760 + 0.128611 WP0236 97.400000 247.240005 - 0.290576 + 0.334389 WP0237 diff --git a/vitosmt.c b/vitosmt.c index f4dc7ab6b..a75ea605c 100644 --- a/vitosmt.c +++ b/vitosmt.c @@ -34,6 +34,7 @@ unsigned long count =0; const size_t vitosmt_headersize =24; const size_t vitosmt_datasize =64; const double mile2km =1.609344; /* mile/h to kilometer/h */ +const double kts2mps =0.51444444444444444; /* knots to m/s */ const double mph2mps =0.447039259; /* mile/h to m/s */ static unsigned long @@ -146,7 +147,7 @@ vitosmt_read(void) elev =ReadDouble(infile); /* elevation in meters */ timestamp =ReadRecord(infile,5); /* UTC time yr/mo/dy/hr/mi */ seconds =ReadDouble(infile); /* seconds */ - speed =ReadDouble(infile); /* speed in miles per hour */ + speed =ReadDouble(infile); /* speed in knots */ course =ReadDouble(infile); /* course in degrees */ pdop =ReadDouble(infile); /* dilution of precision */ gpsfix =fgetc(infile); /* fix type x08,x10, x20 */ @@ -173,7 +174,7 @@ vitosmt_read(void) wpt_tmp->shortname =xcalloc(16,1); snprintf(wpt_tmp->shortname, 15 , "WP%04d", ++serial); - wpt_tmp->speed = speed*mph2mps; /* meters per second */ + wpt_tmp->speed = speed*kts2mps; /* meters per second */ wpt_tmp->course = course; wpt_tmp->pdop = pdop; -- 2.30.2